﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Collections;
using AdaptiveHelpDesk;

namespace Novice
{
    /// <summary>
    /// Summary description for AssigneeDetails
    /// </summary>
    [WebService(Namespace = "http://soaiui.nmmu.ac.za")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class AssigneeDetails : System.Web.Services.WebService
    {
        //Hashtable and arraylist used to load search results
        Hashtable ht = new Hashtable();
        ArrayList values = new ArrayList();

        //initialise stored procedures
        StoredProcedures sp = new StoredProcedures();

        /// <summary>
        /// Return assignee details based on the contact information provided
        /// </summary>
        /// <param name="Contact">Contact identification used to retreive contact information</param>
        /// <returns>Contact Object</returns>
        [WebMethod]
        public assignee ViewSelectedAssignee(String Contact)
        {
            assignee cur = new assignee();
            ArrayList ContactDetails = (ArrayList)sp.getAssigneeDetails(Contact);            

            cur.Firstname   = ContactDetails[1].ToString();
            cur.Lastname    = ContactDetails[2].ToString();
            cur.Group       = ContactDetails[4].ToString();
            cur.Email       = ContactDetails[5].ToString();
            cur.Cell        = ContactDetails[6].ToString();
            cur.Extension   = ContactDetails[7].ToString();

            return cur;
        }
    }
}
